package com.chushouya.controller.product.api;

import com.chushouya.common.annotations.AuthSkip;
import com.chushouya.common.constant.ServiceType;
import com.general.framework.core.schema.Response;
import com.chushouya.product.dto.api.brand.BrandApiQuery;
import com.chushouya.product.dto.api.brand.BrandGroupListApiDTO;
import com.chushouya.product.dto.api.brand.BrandListApiDTO;
import com.chushouya.product.service.api.BrandApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = ServiceType.API + "品牌接口")
@RestController
@RequestMapping( ServiceType.API + "/brand")
@Slf4j
public class BrandApiController {

    @Resource
    private BrandApiService brandApiService;

    @ApiOperation("热门品牌列表")
    @GetMapping("/hotList")
    @AuthSkip
    public Response<List<BrandListApiDTO>> brandList(BrandApiQuery query) {
        return Response.success(brandApiService.brandList(query));
    }

    @ApiOperation("获取品牌分组")
    @GetMapping("/group")
    @AuthSkip
    public Response<List<BrandGroupListApiDTO>> getBrandGroup(BrandApiQuery query) {
        return Response.success(brandApiService.getBrandGroup(query));
    }
}
